package es.ats.codington.festival.mappers;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import es.ats.codington.festival.domain.Event;
/**
 * 
 * @author Codington_RED
 *
 */
public class EventMapper implements RowMapper<Event>{

	/**
	 * obtains the data relative to an Event
	 *@param resulSet
	 *@param numRow
	 *@return event
	 *@throws SQLException
	 */
	@Override
	public Event mapRow(ResultSet resultSet, int numRow) throws SQLException {
		Event event = new Event();
		
		  event.setEventID(resultSet.getInt("eventId"));
		  event.setName(resultSet.getString("name"));
		  event.setDescription(resultSet.getString("description"));
		  event.setPlace(resultSet.getString("place"));
		  event.setStartEvent(resultSet.getString("startEvent"));
		  event.setEndEvent(resultSet.getString("endEvent"));
		  event.setDayEvent(resultSet.getString("dayEvent"));
		  event.setEventType(resultSet.getString("eventType"));
		  event.setSeatsAvailable(resultSet.getInt("seatsAvailable"));
		  event.setIdPlace(resultSet.getInt("idPlace"));
		
		
		return event;
	}

}
